﻿// Copyright: 2012
// Author: Minh Vu - YoungJ
// File: CountConverter.cs - WindowsPhoneRssReader - WindowsPhoneRssReader
// Time: 10:33 PM 05/09/2012

using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using WindowsPhoneRssReader.Models;

namespace WindowsPhoneRssReader.Converter
{
    public class CountConverter : IValueConverter
    {
        #region Implementation of IValueConverter

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var str = parameter as string;
            var items = value as AddRangerObservableCollection<FeedItem>;

            return items == null ? str : str +" "+ items.Count;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return DependencyProperty.UnsetValue;
        }

        #endregion
    }
}